package com.lee.demo1.controller;

import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.lee.demo1.business.SysMenuBusiness;
import com.lee.demo1.domain.SysUser;

@Controller
public class FrameController {
	
	private static Logger logger = LoggerFactory.getLogger(FrameController.class);
	
	@Resource
	private SysMenuBusiness sysMenuBusiness;
	
	
	@RequestMapping("frame")
	public String frame(){
		//logger.debug("-------------------frame--------------------------");
		return "admin/frame";
	}
	
	@RequestMapping("main")
	public String main(){
		return "admin/main";
	}
	
	@RequestMapping("center")
	public String center(){
		return "admin/center";
	}
	@RequestMapping("middel")
	public String middel(){
		return "admin/middel";
	}
	
	@RequestMapping("top")
	public String top(){
		return "admin/top";
	}
	
	/**
	 * 后台frame框架，左侧菜单展示
	 * @param model
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping("left")
	public String left(Model model, HttpServletRequest request){
		SysUser sysUser = (SysUser)request.getSession().getAttribute("sessionSysUser");
		List menulist = sysMenuBusiness.getMenuBySysUserId(sysUser.getId());
		model.addAttribute("menus", menulist);
		return "admin/left";
	}
	
	
	@RequestMapping("right")
	public String right(){
		return "admin/right";
	}
	@RequestMapping("down")
	public String down(){
		return "admin/down";
	}
	@RequestMapping("sysinfo")
	public String sysinfo(){
		return "admin/sysinfo";
	}
	
}
